<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    body {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100vh;
    }

    .img {
      position: absolute;
      background-image: url('https://images.unsplash.com/photo-1576161787924-01bb08dad4a4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2104&q=80');
      background-position: center;
      background-size: cover;
      background-repeat: no-repeat;
      height: 100%;
      width: 100%;
      z-index: -1;
      filter: blur(0px);
    }

    .text {
      color: #fff;
      font-size: 30px;
      font-weight: 700;
    }



  </style>
</head>
<body>
  <div class="text">0%</div>
  <div class="img"></div>

  <script>
    // https://images.unsplash.com/photo-1576161787924-01bb08dad4a4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2104&q=80
    const img = document.querySelector('.img')
    const text = document.querySelector('.text')

    let flag = 0

   let t = setInterval(() => {
    if(flag == 100) clearInterval(t)
      if(flag < 100) {
        flag++
      img.style.filter = `blur(${100 - flag}px)`
      text.innerText = flag + '%'
      text.style.opacity =  1 - (flag / 100) 
      }
    },30)

    // while (flag < 100) {
    //   flag++
    //   img.style.filter = `blur(${100 - flag})`
    //   text.innerText = flag + '%'
    //   text.style.opacity =  1 - (flag / 100) 
    // }


  </script>
  
</body>
</html>